package com.sj.排序算法;

import java.util.Arrays;

/**
 * @author sj
 * @date 2021/5/2
 **/
public class 冒泡排序 {
    public static void main(String[] args) {
        int[] arr = {2,3,5,4,2,6,45,25,1};
        int temp= 0;
        for (int i = 0 ; i < arr.length ; i++){
            for (int j = 0 ; j < arr.length - 1 ; j ++){
                if (arr[j] > arr[j+1]){
                    temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
